Repository navigation
Brightness of a time series (time_series, plan N72) - #113
Merged
Merged
Conversation
…pticalFlow3D Profiler frame_means, brightness_trend, equalise_brightness and match_histograms, time first, against a reference time point the caller chooses (contract section 3.7). Additive: no existing output, API, column or schema_version changes; NumPy only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G3qp9AERqtoqUxiixuPVPV
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G3qp9AERqtoqUxiixuPVPV
This was referenced Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A new module,
time_series, moved from the OpticalFlow3D Profiler (itsbrightness.py) at the owner's request (plan N72, contract §3.7). It is for methods that assume constant brightness across time, such as optical flow:frame_means(stack): one float64 mean per time point. Time is the first axis; the other axes (ZYX/YX) are pooled.brightness_trend(means, reference): the least-squares slope of the means against the time index, divided by the reference mean. It is a check and changes nothing.equalise_brightness(stack, reference): each time point is scaled to the reference's mean (Fiji's "Simple Ratio" without a background). Returns the scaled float64 series and the factors.match_histograms(stack, reference): each time point's distribution is mapped onto the reference's (Fiji's "Histogram Matching",p' = interp(F_t(p), F_ref, v_ref)). The reference time point is unchanged.TimeSeriesError(aValueError) refuses non-finite pixels, arrays without a time axis, non-numeric types, an invalid reference index (a boolean or float is never converted), and equalisation of a time point whose mean is not above 0. Every message names the problem.The caller chooses the reference time point; the profiler will pass the central frame of each optical-flow window. The formulas are the profiler's, unchanged, so its results stay bit-identical after it switches to this module.
Scope
schema_versionchanges; the package still imports with NumPy only. Nothing infitorapplycalls the new functions.purein the code-rules layers; exported from the package.Checks
python tools/check.py: code rules, Ruff and pytest pass (2,703 passed, 90 skipped). The skips are the optional scikit-image tests, as onmain.tests/test_time_series.pychecks each function against a direct implementation: means, slope, scaled series and factors, and CDF matching with monotonicity. It also checks that inputs are never modified, the 2-D and 3-D layouts, and every refusal.Follow-up
Generated by Claude Code